@layout("/common/_curd/_container.html"){

<script type="text/javascript">
	var ctx = "${basePath}";
	var grid_selector = "#grid-table";
	var pager_selector = "#grid-pager";
	
	$(function(){
		initGrid();
		initMenuBtn("btns", "${code}");
	});
	
	function initGrid(){
		var grid_url = ctx + "/${code}/list";
		var _colnames = ["", 
						"成员名称",
                        "班级",
                        "校讯通",
                        "电话号码",
						"班级",
						"职位",
                         "操作"];
		var _colmodel = [{name:"id", index:"id", width:100,hidden:true},
						{name:"name", index:"name", width:100},
                        {name:"class_name", index:"class_name", width:100},
                        {name:"last_code", index:"last_code",formatter:fmatterReg, width:100},
                        {name:"mobile", index:"mobile", width:100},
                        {name:"class_id", index:"class_id", hidden:true},
						{name:"position", index:"position", width:100},
                         {name: 'id',formatter:fmatterOperation, width:200,sortable:false}
        ];
		
		jQuery(grid_selector).jqGrid({
			url : grid_url,
		    shrinkToFit : true,
			colNames : _colnames,
			colModel : _colmodel, 
			jsonReader : {id :"id"},
			pager : pager_selector,
			postData : {sort : "id", order : "desc"}
		});
	}
    function fmatterReg(cellvalue, options, rowObject){
        if (cellvalue){
            return '<span class="label label-sm label-success">已注册</span>';
        }else{
            return '<span class="label label-sm label-warning">未注册</span>';
        }
    }

    function fmatterOperation(cellvalue, options, rowObject){
        return '<button class="btn btn-primary btn-sm" onclick="add_parent('+cellvalue+')">新增家长</button>';
    }

    function add_parent(stu_id){
        var index=layer.open({
            type: 2,
            title:"学生名单管理→新增家长",
            area: ["800px","520px"],
            fix: false, //不固定
            maxmin: true,
            content: ctx + "/parent/add?stuId="+stu_id
        });
    }
</script>


	<!-- 配置 grid -->
	<div class="row">
		<div class="col-xs-12 tb-grid">
			<!-- 配置 查询 -->
			@ var _col=[
			@		{name:"学生姓名", index:"name", type:"text"},
			@		{name:"班级", index:"class_id_equal", type:"select_classes", placeholder:"选择班级"},
			@		{name:"是否毕业", index:"is_graduate_equal", type:"select_1002" , placeholder:"是否毕业"}
			@];
			@ include("/common/_function/_search2.html",{"col":_col}){}
			<!-- 按钮 -->
			<div class="welljq well-sm" id="btns"></div>
			<!-- grid -->
			<table id="grid-table"></table>
			<!-- 分页-->
			<div id="grid-pager"></div>
		</div>
	</div>
	
	<!-- 引入所需的js -->
	@include("/common/_listscript.html"){}
	
@}	